import request from '../request'

//发送验证码
export async function sendVerificationCodeApi(data: { email: string,purpose:string }) {
    return request<null>({
        url: '/auth/verification-code',
        method: 'POST',
        skipAuth:true,
        data
    })
}

export async function validateCodeApi(data: { email: string, code: string, purpose: string, verificationToken?: string }) {
    console.log('验证验证码API:', data)
    return request<null>({
        url: '/auth/verification-code/validate',
        method: 'POST',
        data
    })
}
export async function registerApi(data: { username: string, email: string, password: string }) {
    return request<null>({
        url: '/auth/register',
        method: 'POST',
        data
    })
}

// 重置密码
export async function resetPasswordApi(data: { email: string; verificationCode: string; newPassword: string }) {
    return request<null>({
        url: '/auth/reset-password',
        method: 'POST',
        skipAuth: true,
        data
    })
}
